/*
	jumper : Copyright 2011 Dale J Williams

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/
package lads.jumper.entities {
	
	import flash.display.Loader;
	import flash.display.MovieClip;
	import flash.events.Event;
	import flash.utils.ByteArray;
	import lads.jumper.controllers.KeyboardController;
	import lads.jumper.library.Library;
	import lads.jumper.states.StandState;
	
	/**
	 * Player: In this instance, Laderick.
	 * @author Dale J Williams
	 */
	public class Player extends Actor {
		
		private var asset:MovieClip;
		private var cycle:String;
		
		public function Player() {
			super("player");
		}
		
		override public function awake():void {
			super.awake();
			loadClip();
			controller = new KeyboardController(core.input);
		}
		
		public function start():void {
			state.changeState(new StandState(this));
		}
		
		override public function update():void {
			super.update();
		}
		
		private function loadClip():void {
			var loader:Loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, callback);
			loader.loadBytes(new Library.Lad() as ByteArray);
			
			function callback():void {
				clip = loader.contentLoaderInfo.content as MovieClip;
			}
		}
	
	}

}